<?php 
$zebra=0;
if ($data->num_rows() > 0):

	//load notifikasi
	$CI =& get_instance();
	$CI->load->model('perbuatan_notifikasi_model');
	$CI->load->model('detachievement_model');
	$CI->load->model('bap_model');
	$CI->load->model('bap_sign_model');
	
	foreach($data->result_array() as $ch):
		$notif = $CI->perbuatan_notifikasi_model;
		$opened = $notif->hasBeenOpened($usrName,'AP',$ch['perb_id']);
		$notif = $notif->getNotification($usrName,'AP',$ch['perb_id']);
		
		//create status signed, if already signed
		$bapData = (array)$CI->bap_model->select_by_perbID($ch['perb_id'])->row();
		$hasGiveSign = $CI->bap_sign_model->has_give_sign($bapData['bap_id'],$usrName);

?>
	<tr class="fakeLink<?php if ($zebra++%2==1 && $opened):?> zebra <?php endif?> <?php if (!$opened):?>notification"<?php endif?>" 
		onmouseover="$(this).getElements('select[class:selectButton]').setStyle('visibility','visible')"
		onmouseout="$(this).getElements('select[class:selectButton]').setStyle('visibility','hidden')",
		onclick="redirectToView('<?php echo $notif? $notif['perb_notif_id'] : ""?>','<?php echo $ch['perb_id']?>','AP')">
	<td><?php echo $ch['perb_tgl_lapor']?></td>
	<td><?php echo $ch['perb_tgl_kejadian']?></td>
	<td><?php echo $ch['perb_tempat_kejadian']?></td>
	<td><?php echo $ch['perb_keterangan']?></td>
	<td><?php echo $hasGiveSign? "Signed" : "Not Signed"?></td>
	<td align="right" width="1px"></td>
	</tr>
<?php 
	endforeach;
else:
?><tr><td align="center" colspan="6">Tidak ada data</td></tr><?php 
endif;